package com.networklib.task.service;

import com.networklib.TaskResult;
import com.networklib.task.base.ATask;
import com.networklib.task.base.TaskService;

import java.util.Collection;
import java.util.Iterator;

/**
 * Created by ASUS on 2017/6/14.
 */

public class FlowTaskService extends TaskService {
    @Override
    public void excute() {
        Iterator<ATask> iterator = aTaskHashMap.values().iterator();
        if (iterator.hasNext()) {
            submit(iterator.next());
        }
    }

    @Override
    public void after(TaskResult taskResult) {
        super.after(taskResult);
        aTaskHashMap.remove(taskResult.getTag());
        excute();
    }
}
